package com.haier.nengyuan.myapplication;

import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.util.Log;

/**
 * Created by liuxinming on 17-9-4.
 */

public class BootBroadcastReceiver extends BroadcastReceiver {

    private static final String TAG = "BootBroadcastReceiver";

    private static final String ACTION_BOOT = "android.intent.action.BOOT_COMPLETED";
    @Override
    public void onReceive(Context context, Intent intent) {

        if (intent.getAction().equals(ACTION_BOOT)) {
            Log.i(TAG, "BootBroadcastReceiver onReceive(), Do thing!");
//            Intent intent2=new Intent(context,ExampleService.class);
//            context.startService(intent2);
            Intent intent1 = context.getPackageManager().getLaunchIntentForPackage("com.haier.nengyuan.myapplication");
            context.startActivity(intent1);
            Log.e("TAG", "开机自动服务自动启动.....");
        }
    }
}
